package org.efssc
def GetMetadata(APPNAME,APPBRANCH) {
    def datas = readYaml file: "./pro_metadata/${appname}_cicd.yaml"

//    println(datas.getClass());
//    def lst = datas.spec.envVar
//    def newlists = []
//    lst.each{
//        String its = "${it}"
//        newlists << "${its}"
//    }
//    string newlist = newlists
//    print(newlist.getClass())
//    print(newlist)
    if (datas.metadata.app == "${APPNAME}") {
        env.appname = datas.metadata.app
        env.appgiturl = datas.metadata.src
        env.appversion = datas.metadata.appVersion
        env.appbranch = "${APPBRANCH}"
        env.apptype = datas.metadata.type    //springboot,npm
        env.namespace = datas.metadata.namespace
    }
    if("${apptype}"=="springboot" ){
        env.container = "maven"
    }else if("${apptype}" == "npm"){
        env.container = "nodejs"
    }
    return ["${appname}", "${appgiturl}", "${appversion}", "${appbranch}", "${apptype}", "${apptype}","${container}","${namespace}"]
}

